﻿using System.Collections.Generic;

namespace Infrastructure.DAL.SeedWork
{
    public interface ISql
    {
        /// <summary>
        ///     Execute specific query with underliying persistence store
        /// </summary>
        /// <typeparam name="TEntity">Entity type to map query results</typeparam>
        /// <param name="sqlQuery">
        ///     Dialect Query
        ///     <example>
        ///         SELECT idCustomer,Name FROM dbo.[Customers] WHERE idCustomer > {0}
        ///     </example>
        /// </param>
        /// <param name="parameters">A vector of parameters values</param>
        /// <returns>
        ///     Enumerable results
        /// </returns>
        IEnumerable<TEntity> ExecuteQuery<TEntity>(string sqlQuery, params object[] parameters);

        /// <summary>
        ///     Execute arbitrary command into underliying persistence store
        /// </summary>
        /// <param name="sqlCommand">
        ///     Command to execute
        ///     <example>
        ///         SELECT idCustomer,Name FROM dbo.[Customers] WHERE idCustomer > {0}
        ///     </example>
        /// </param>
        /// <param name="parameters">A vector of parameters values</param>
        /// <returns>The number of affected records</returns>
        int ExecuteCommand(string sqlCommand, params object[] parameters);
    }
}